<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<input type="text" id="t">
	<span id="sp"></span>

	<script>
		var a=document.getElementById('t');
		var s=document.getElementById('sp');

		a.onfocus=function(){
			s.innerHTML='不能修改的喔';
		}

		a.onblur=function(){
			var name=a.value;
			if (name=='xlw') {
				s.innerHTML='名字已被占用';
			}else s.innerHTML='名字可用'
		}
	</script>
</body>
</html>